﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    
    <style type="text/css">
        h2 {
            page-break-before: always;
        }

        .content90 {
            width: 100%;
            float: left;
        }

        .content45 {
            width: 45%;
            padding-top: 5px;
            padding-bottom: 5px;
        }

        .firstcolumn {
            float: left;
        }

        .secoundcolumn {
            float: left;
            padding-left: 20px;
        }

        .value {
            padding-left: 20px;
        }

        .tablePrint {
            padding-top: 10PX;
        }

        table {
            padding-top:20px;
            border-collapse: collapse;
        }

    </style>
    <script src="/scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/scripts/jquery.easyui.min.js"></script>
    <script src="/scripts/kss/helper.js"></script>
    	<script src="/scripts/json2.js"></script>
    <script type="text/javascript">
        var helper = new KssHelper();
        jQuery(document).ready(function () {
            var data2 = getParameterByName("cashSelete");
            var datacash = JSON.parse(data2);


            var mname = "";
            var mid = "";
            var mcash = "";
            var mdev = "";
            var row = '<tr><th style="width:20%; text-align:left;">เอกสารเลขที่</th><th style="width:60%; text-align:left;">ชื่อเรื่อง</th><th style="width:15%;text-align:left;">คะแนน</th><th style="width:15%;text-align:left;">รางวัล</th></tr>'
            jQuery.each(datacash, function (i, d) {
                mname = d.createdByName;
                mid = d.createdBy;
                mdev = d.departmentName;
                mcash += d.cash;
                var col = '';
                row += '<tr><td style="width:20%;text-align:left;">' + d.id + '</td>' + '<td style="width:60%; text-align:left;">' + d.title + '</td>' + '<td style="width:15%;text-align:left;">' + d.score + '</td>' + '<td style="width:15%;text-align:left;">' + d.cash + '</td></tr>';
            });
            jQuery("#dateToday").html(dateThai());
            jQuery("#cash").html(mcash);
            jQuery("#empSection").html(mdev);
            jQuery("#name").html(mname);
            jQuery("#empId").html(mid);
            jQuery("#tablePrint").html("<table style='width:100%; padding-top:20px;'>" + row + "</table>");

            //            helper.PrintCashs(data2, function (result) {
            //                if (result.length > 0) {
            //                    var mname, mid, msec, mcash;
            //                    var tablePrint;
            //                    var row = '<tr><th style="width:15%">เอกสารเลขที่</th><th style="width:65%; text-align:left;">ชื่อเรื่อง</th><th style="width:15%">คะแนน</th><th style="width:15%">รางวัล</th></tr>';
            //                    jQuery.each(result, function (i, d) {
            //                        mname = d.mtitleth + " " + d.mnameth + " " + d.msurnameth;
            //                        mid = d.mempid;
            //                        msec = d.DepName;
            //                        mcash += d.cash;
            //                        var col = '';
            //                        row += '<tr><td style="width:15%">' + d.id + '</td>' + '<td style="width:65%; text-align:left;">' + d.title + '</td>' + '<td style="width:15%">' + d.score + '</td>' + '<td style="width:15%">' + d.cash + '</td></tr>';
            //                    });
            //                    //var reportWindow = window.open("/report/PayCashPrint.html", "reportWindow", "menubar,scrollbars,left=30px,top=40px,height=700px,width=800px");
            //                    jQuery("#dateToday").html(new Date().toLocaleDateString());
            //                    jQuery("#cash").html(mcash);
            //                    jQuery("#name").html(mname);
            //                    jQuery("#empId").html(mid);
            //                    jQuery("#empSection").html(msec);
            //                    jQuery("#tablePrint").html("<table style='width:100%; padding-top:20px;'>" + row + "</table>");
            //                }
            //            });
        });
        function getParameterByName(name) {
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
            return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
        }

        function dateThai() {
            var now = new Date();
            var year = now.getFullYear();
            var thmonth = new Array("มกราคม", "กุมภาพันธ์", "มีนาคม",
                "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน",
                "ตุลาคม", "พฤศจิกายน", "ธันวาคม");

            if (year < 2500) {
                year = year + 543;
            }
            return now.getDate() + " " + thmonth[now.getMonth()] + " " + year;
        }
    </script>
</head>
<body>
    <h1 style="text-align: center">เงินรางวัล Kaisen Suggestion</h1>
    <div >
    <div class="content90">
        <div class="content45 firstcolumn" ><span>วันที่ :</span><span class="value" id="dateToday"></span> </div>
        <div class="content45 secoundcolumn"><span>รวมยอดเงิน :</span><span class="value" id="cash"> 180</span></div>
    </div>
    <div style="clear: both"></div>
    <div class="content90">
        <div class="content45 firstcolumn"><span>ชื่อ - นามสกุล :</span><span class="value" id="name"> 5555</span></div>
        <div class="content45 secoundcolumn"><span>เลขประจำตัว :</span><span class="value" id="empId"> 5555</span></div>
    </div>
    <div style="clear: both"></div>
    <div class="content90">
        <div><span>หน่วยงาน :</span><span class="value" id="empSection"> 5555</span></div>
    </div>
    <hr />
    <hr />
   
     <div id="tablePrint">

     </div>
                </div>
</body>
</html>
